﻿<ContentControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                HorizontalContentAlignment="Stretch"
                VerticalContentAlignment="Stretch"
                FontSize="14"
                d:DesignHeight="600"
                d:DesignWidth="1000"
                mc:Ignorable="d">
    <ContentControl.Resources>
        <Style x:Key="STYLE_TOPMENU" TargetType="ListBoxItem">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <Grid>
                            <Grid Background="{StaticResource InnerShadowDarkBrush}" Visibility="{Binding IsSelected, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}" />
                            <TextBlock Text="{Binding Title}" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="STYLE_SUBMENU" TargetType="ListBoxItem">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <Grid>
                            <Border Background="{StaticResource InnerShadowDarkBrush}"
                                    CornerRadius="3,3,0,0"
                                    Visibility="{Binding IsSelected,
                                                         Converter={StaticResource BooleanToVisibilityConverter},
                                                         RelativeSource={RelativeSource TemplatedParent}}" />
                            <TextBlock Margin="12,6"
                                       Text="{Binding Title}"
                                       Visibility="{Binding IsSelected,
                                                            Converter={StaticResource BooleanToVisibilityInverseConverter},
                                                            RelativeSource={RelativeSource TemplatedParent}}" />
                            <TextBlock Margin="12,6"
                                       Foreground="White"
                                       Text="{Binding Title}"
                                       Visibility="{Binding IsSelected,
                                                            Converter={StaticResource BooleanToVisibilityConverter},
                                                            RelativeSource={RelativeSource TemplatedParent}}" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </ContentControl.Resources>
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid Background="{StaticResource GrayBrush1}" />
        <Grid Grid.RowSpan="2"
              Width="{StaticResource ContentMaxWidth}"
              HorizontalAlignment="Center">
            <Grid.RowDefinitions>
                <RowDefinition Height="30" />
                <RowDefinition Height="auto" />
                <RowDefinition />
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <ListBox Background="Transparent"
                         BorderThickness="0"
                         ItemsSource="{Binding TopurlCollection}"
                         SelectedItem="{Binding SelectedTopurl,
                                                Mode=TwoWay}"
                         Style="{StaticResource STYLE_NAVIBOX}" ItemContainerStyle="{StaticResource STYLE_TOPMENU}">
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel Orientation="Horizontal" />
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                </ListBox>
            </Grid>
            <Grid Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <ContentControl Content="BOYIN" FontSize="{StaticResource Heading1FontSize}" />
                <Grid Grid.Column="1">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition Height="12" />
                    </Grid.RowDefinitions>
                    <ListBox Style="{StaticResource STYLE_NAVIBOX}" ItemContainerStyle="{StaticResource STYLE_SUBMENU}"/>
                    <Grid Grid.Row="1" Background="{StaticResource COLOR_DARK}" />
                </Grid>
            </Grid>
            <navigation:Frame x:Name="ContentFrame"
                              Grid.Row="2"
                              JournalOwnership="OwnsJournal"
                              Padding="0"
                              Source="{Binding ViewUrl}"
                              Style="{StaticResource NavContentFrameStyle}" />
        </Grid>
    </Grid>
    
</ContentControl>
